package cn.itcast.dubbo.component;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @author Hujf
 * @title: UrlControllerFilter
 * @description: TODO
 * @date 2020/7/23 0023上午 9:14
 */
@WebFilter(urlPatterns = "/*")
public class UrlControllerFilter implements Filter {


    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("开始服务");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest servletRequest = (HttpServletRequest) request;
        HttpServletResponse servletResponse = (HttpServletResponse) response;
        HttpSession session = servletRequest.getSession();
        String  path = servletRequest.getRequestURI();
      //  User user = (User) session.getAttribute("user");

        chain.doFilter(servletRequest, servletResponse);
        return;
    }
}
